﻿#region Copyright (C) Sector7 Software Studio. All rights reserved
/*******************************************************************************************
 * Creation
 *      Author:         Wolf Lai
 *      Date:           2013/6/21 星期五 21:25:30
 *      Version:        
 * Modification 
 *      Author: 
 *      Date: 
 *      Description: 
 *      Version:
 *******************************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sector7.Medical.Utility;
using Sector7.Framework.Core;
using Sector7.Medical.EntityType;
using Sector7.Framework.EntityType;

namespace Sector7.Medical.Biz
{
    /// <summary>
    /// INFS代理
    /// </summary>
    public class Agent_INFS
    {
        #region Public functions
        public static List<M7_DrugType> GetDrugTypeTree()
        {
            return WcfClient.INFS.Invoke<List<M7_DrugType>>(
                service => service.GetDrugTypeList());
        }

        public static int AddPhysicalType(M7_DrugType physicalType)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.AddDrugType(physicalType));
        }

        public static int AddNatureType(M7_DrugType natureType)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.AddDrugType(natureType));
        }

        public static int UpdateDrugType(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateDrugType(delta));
        }

        public static List<M7_DrugForm> GetDrugFormList()
        {
            return WcfClient.INFS.Invoke<List<M7_DrugForm>>(
                service => service.GetDrugFormList());
        }

        public static List<M7_DrugRegType> GetDrugRegTypeList()
        {
            return WcfClient.INFS.Invoke<List<M7_DrugRegType>>(
                service => service.GetDrugRegTypeList());
        }

        public static List<M7_Unit> GetUnitListByFlags(int flags)
        {
            return WcfClient.INFS.Invoke<List<M7_Unit>>(
                service => service.GetUnitListByFlags(flags));
        }

        public static List<M7_Unit> GetUnitList()
        {
            return WcfClient.INFS.Invoke<List<M7_Unit>>(
                service => service.GetUnitList());
        }

        public static int AddUnit(M7_Unit unit)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.AddUnit(unit));
        }

        public static int UpdateUnit(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateUnit(delta));
        }

        public static int DeleteUnit(int unitId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteUnit(unitId));
        }

        public static int CountByDrugName(string drugName)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.CountByDrugName(drugName));
        }

        public static List<M7_Drug> GetDrugListByNatureTypeId(int natureTypeId)
        {
            return WcfClient.INFS.Invoke<List<M7_Drug>>(
                service => service.GetDrugListByNatureTypeId(natureTypeId));
        }

        public static List<M7_Drug> ResetDrugList()
        {
            return new List<M7_Drug>();
        }

        public static long AddDrug(M7_Drug drug)
        {
            return WcfClient.INFS.Invoke<long>(
                service => service.AddDrug(drug));
        }

        public static int UpdateDrug(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateDrug(delta));
        }

        public static int DeleteDrugType(int drugTypeId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteDrugType(drugTypeId));
        }

        public static int DeleteDrug(long drugId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteDrug(drugId));
        }

        public static List<M7_Drug> GetDrugListByKeywords(string keywords)
        {
            return WcfClient.INFS.Invoke<List<M7_Drug>>(
                service => service.GetDrugListByKeywords(keywords));
        }

        /// <summary>
        /// 根据科室标志获取所有科室信息
        /// </summary>
        /// <param name="flags">科室标志</param>
        /// <returns></returns>
        public static List<M7_Department> GetDepartmentList(int flags)
        {
            return WcfClient.INFS.Invoke<List<M7_Department>>(
                service => service.GetDepartmentList(flags));
        }

        public static List<M7_Department> GetDepartmentListByComflags(int comflags)
        {
            return WcfClient.INFS.Invoke<List<M7_Department>>(
                service => service.GetDepartmentListByComflags(comflags));
        }

        /// <summary>
        /// 添加科室
        /// </summary>
        /// <param name="department">科室信息</param>
        /// <returns></returns>
        public static object AddDepartment(M7_Department department)
        {
            return WcfClient.INFS.Invoke<object>(
                service => service.AddDepartment(department));
        }

        /// <summary>
        /// 编辑科室
        /// </summary>
        /// <param name="delta">科室信息</param>
        /// <returns></returns>
        public static int UpdateDepartment(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateDepartment(delta));
        }

        /// <summary>
        /// 编辑二级科室Flags
        /// </summary>
        /// <param name="parentDeptId">一级科室ID</param>
        /// <param name="flags">标志</param>
        /// <returns></returns>
        public static int UpdateSubDepartmentFlags(int parentDeptId, int flags)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateSubDepartmentFlags(parentDeptId, flags));
        }

        /// <summary>
        /// 删除科室
        /// </summary>
        /// <param name="departmentId">科室信息ID</param>
        /// <returns></returns>
        public static int DeleteDepartment(int departmentId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteDepartment(departmentId));
        }

        /// <summary>
        /// 获取所有病区信息
        /// </summary>
        /// <returns></returns>
        public static List<M7_SickArea> GetSickAreaList()
        {
            return WcfClient.INFS.Invoke<List<M7_SickArea>>(
                service => service.GetSickAreaList());
        }

        /// <summary>
        /// 添加病区
        /// </summary>
        /// <param name="area">病区信息</param>
        /// <returns></returns>
        public static object AddSickArea(M7_SickArea area)
        {
            return WcfClient.INFS.Invoke<object>(
                service => service.AddSickArea(area));
        }

        /// <summary>
        /// 编辑病区
        /// </summary>
        /// <param name="delta">病区信息</param>
        /// <returns></returns>
        public static int UpdateSickArea(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateSickArea(delta));
        }

        /// <summary>
        /// 删除病区
        /// </summary>
        /// <param name="areaId">病区ID</param>
        /// <returns></returns>
        public static int DeleteSickArea(int areaId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteSickArea(areaId));
        }

        #region SickRoom
        /// <summary>
        /// 获取所有病房信息
        /// </summary>
        /// <returns></returns>
        public static List<M7_SickRoom> GetSickRoomList()
        {
            return WcfClient.INFS.Invoke<List<M7_SickRoom>>(
                service => service.GetSickRoomList());
        }

        /// <summary>
        /// 添加病房
        /// </summary>
        /// <param name="room">病房信息</param>
        /// <returns></returns>
        public static object AddSickRoom(M7_SickRoom room)
        {
            return WcfClient.INFS.Invoke<object>(
                service => service.AddSickRoom(room));
        }

        /// <summary>
        /// 编辑病房
        /// </summary>
        /// <param name="delta">病房信息</param>
        /// <returns></returns>
        public static int UpdateSickRoom(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateSickRoom(delta));
        }

        /// <summary>
        /// 删除病房
        /// </summary>
        /// <param name="roomId">病房ID</param>
        /// <returns></returns>
        public static int DeleteSickRoom(int roomId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteSickRoom(roomId));
        }
        #endregion

        #region SickBedLevel
        /// <summary>
        /// 获取所有病床等级信息
        /// </summary>
        /// <returns></returns>
        public static List<M7_SickBedLevel> GetSickBedLevelList()
        {
            return WcfClient.INFS.Invoke<List<M7_SickBedLevel>>(
                service => service.GetSickBedLevelList());
        }

        /// <summary>
        /// 添加病床等级信息
        /// </summary>
        /// <param name="bedLevel">病床等级信息</param>
        /// <returns></returns>
        public static object AddSickBedLevel(M7_SickBedLevel bedLevel)
        {
            return WcfClient.INFS.Invoke<object>(
                service => service.AddSickBedLevel(bedLevel));
        }

        /// <summary>
        /// 编辑病床等级信息
        /// </summary>
        /// <param name="delta">病床等级信息</param>
        /// <returns></returns>
        public static int UpdateSickBedLevel(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateSickBedLevel(delta));
        }

        /// <summary>
        /// 删除病床等级信息
        /// </summary>
        /// <param name="bedLevelId">病床等级信息ID</param>
        /// <returns></returns>
        public static int DeleteSickBedLevel(int bedLevelId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteSickBedLevel(bedLevelId));
        }
        #endregion

        #region SickBed
        /// <summary>
        /// 获取所有病床信息
        /// </summary>
        /// <returns></returns>
        public static List<M7_SickBed> GetSickBedList()
        {
            return WcfClient.INFS.Invoke<List<M7_SickBed>>(
                service => service.GetSickBedList());
        }

        /// <summary>
        /// 根据病区和科室获取其信息列表
        /// </summary>
        /// <param name="deptId"></param>
        /// <returns></returns>
        public static List<M7_SickBed> GetSickBedListByAreaId(int areaId)
        {
            return WcfClient.INFS.Invoke<List<M7_SickBed>>(
                service => service.GetSickBedListByAreaId(areaId));
        }

        /// <summary>
        /// 根据病区和科室获取其信息列表
        /// </summary>
        /// <param name="areaId"></param>
        /// <param name="deptId"></param>
        /// <returns></returns>
        public static List<M7_SickBed> GetSickBedListByAreaDeptId(int areaId, int deptId)
        {
            return WcfClient.INFS.Invoke<List<M7_SickBed>>(
                service => service.GetSickBedListByAreaDeptId(areaId, deptId));
        }

        /// <summary>
        /// 添加病床
        /// </summary>
        /// <param name="bed">病床信息</param>
        /// <returns></returns>
        public static object AddSickBed(M7_SickBed bed)
        {
            return WcfClient.INFS.Invoke<object>(
                service => service.AddSickBed(bed));
        }

        /// <summary>
        /// 编辑病床
        /// </summary>
        /// <param name="bed">病床信息</param>
        /// <returns></returns>
        public static int UpdateSickBed(M7_SickBed bed)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateSickBed(bed));
        }

        /// <summary>
        /// 删除病床
        /// </summary>
        /// <param name="bedId">病床ID</param>
        /// <returns></returns>
        public static int DeleteSickBed(int bedId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteSickBed(bedId));
        }
        #endregion

        #region ChargeItem

        /// <summary>
        /// 获取所有收费项
        /// </summary>
        /// <returns></returns>
        public static M7_ChargeItem GetChargeItem(int chargeItemId)
        {
            return WcfClient.INFS.Invoke<M7_ChargeItem>(
                service => service.GetChargeItem(chargeItemId));
        }

        /// <summary>
        /// 获取所有收费项列表
        /// </summary>
        /// <returns></returns>
        public static List<M7_ChargeItem> GetChargeItemList()
        { 
            return WcfClient.INFS.Invoke<List<M7_ChargeItem>>(
                service => service.GetChargeItemList());
        }

        /// <summary>
        /// 添加收费项列表
        /// </summary>
        /// <returns></returns>
        public static object AddChargeItem(M7_ChargeItem chargeItem)
        {
            return WcfClient.INFS.Invoke<object>(
                service => service.AddChargeItem(chargeItem));
        }

        /// <summary>
        /// 编辑收费项列表
        /// </summary>
        /// <param name="delta"></param>
        /// <returns></returns>
        public static int UpdateChargeItem(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateChargeItem(delta));
        }

        /// <summary>
        /// 删除收费项列表
        /// </summary>
        /// <param name="itemId">收费项信息ID</param>
        /// <returns></returns>
        public static int DeleteChargeItem(int itemId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteChargeItem(itemId));
        }
        #endregion

        #region RegistryFee
        /// <summary>
        /// 获取所有挂号费信息
        /// </summary>
        /// <returns></returns>
        public static List<M7_RegistryFee> GetRegistryFeeList()
        {
            return WcfClient.INFS.Invoke<List<M7_RegistryFee>>(
                service => service.GetRegistryFeeList());
        }

        /// <summary>
        /// 添加挂号费信息
        /// </summary>
        /// <param name="registryFee">挂号费信息</param>
        /// <returns></returns>
        public static object AddRegistryFee(M7_RegistryFee registryFee)
        {
            return WcfClient.INFS.Invoke<object>(
                service => service.AddRegistryFee(registryFee));
        }

        /// <summary>
        /// 编辑挂号费信息
        /// </summary>
        /// <param name="delta">挂号费信息</param>
        /// <returns></returns>
        public static int UpdateRegistryFee(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateRegistryFee(delta));
        }

        /// <summary>
        /// 删除挂号费信息
        /// </summary>
        /// <param name="itemId">挂号费信息ID</param>
        /// <returns></returns>
        public static int DeleteRegistryFee(int feeId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteRegistryFee(feeId));
        }
        #endregion

        /// <summary>
        /// 获取所有员工组信息
        /// </summary>
        /// <returns></returns>
        public static List<M7_EmployeeGroup> GetEmployeeGroupList()
        {
            return WcfClient.INFS.Invoke<List<M7_EmployeeGroup>>(
                service => service.GetEmployeeGroupList());
        }

        /// <summary>
        /// 添加员工组
        /// </summary>
        /// <param name="employeeGroup">员工组信息</param>
        /// <returns></returns>
        public static object AddEmployeeGroup(M7_EmployeeGroup employeeGroup)
        {
            return WcfClient.INFS.Invoke<object>(
                service => service.AddEmployeeGroup(employeeGroup));
        }

        /// <summary>
        /// 编辑员工组
        /// </summary>
        /// <param name="delta">员工组信息</param>
        /// <returns></returns>
        public static int UpdateEmployeeGroup(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateEmployeeGroup(delta));
        }

        /// <summary>
        /// 删除员工组
        /// </summary>
        /// <param name="employeeGroupId">员工组ID</param>
        /// <returns></returns>
        public static int DeleteEmployeeGroup(int employeeGroupId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteEmployeeGroup(employeeGroupId));
        }

        /// <summary>
        /// 获取所有员工信息
        /// </summary>
        /// <returns></returns>
        public static List<M7_Employee> GetEmployeeList()
        {
            return WcfClient.INFS.Invoke<List<M7_Employee>>(
                service => service.GetEmployeeList());
        }

        /// <summary>
        /// 获取所有医生
        /// </summary>
        /// <returns></returns>
        public static List<M7_Employee> GetDoctorOrSpecialist()
        {
            return WcfClient.INFS.Invoke<List<M7_Employee>>(
                service => service.GetDoctorOrSpecialist());
        }

        /// <summary>
        /// 添加员工
        /// </summary>
        /// <param name="employee">员工</param>
        /// <returns></returns>
        public static int AddEmployee(M7_Employee employee)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.AddEmployee(employee));
        }

        /// <summary>
        /// 编辑员工
        /// </summary>
        /// <param name="employee">员工信息</param>
        /// <returns></returns>
        public static int UpdateEmployee(M7_Employee employee)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateEmployee(employee));
        }

        /// <summary>
        /// 删除员工
        /// </summary>
        /// <param name="employeeId">员工ID</param>
        /// <returns></returns>
        public static int DeleteEmployee(long employeeId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteEmployee(employeeId));
        }

        /// <summary>
        /// 根据证件类型和证件号获取人员信息
        /// </summary>
        /// <param name="identityType">证件号类型ID</param>
        /// <param name="identityId">证件号</param>
        /// <returns></returns>
        public static S7_Citizen GetCitizenByIdentityId(int identityTypeId, string identityId)
        {
            return WcfClient.INFS.Invoke<S7_Citizen>(
                service => service.GetCitizenByIdentityId(identityTypeId, identityId));
        }

        /// <summary>
        /// 获取所有个人信息
        /// </summary>
        /// <returns></returns>
        public static List<S7_Citizen> GetCitizenList()
        {
            return WcfClient.INFS.Invoke<List<S7_Citizen>>(
                service => service.GetCitizenList());
        }

        /// <summary>
        /// 添加个人信息
        /// </summary>
        /// <param name="citizen">个人信息</param>
        /// <returns></returns>
        public static int AddCitizen(S7_Citizen citizen)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.AddCitizen(citizen));
        }

        /// <summary>
        /// 编辑个人信息
        /// </summary>
        /// <param name="citizen">个人信息信息</param>
        /// <returns></returns>
        public static int UpdateCitizen(S7_Citizen citizen)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.UpdateCitizen(citizen));
        }

        /// <summary>
        /// 删除个人信息
        /// </summary>
        /// <param name="citizenId">个人信息ID</param>
        /// <returns></returns>
        public static int DeleteCitizen(string citizenId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteCitizen(citizenId));
        }

        /// <summary>
        /// 获取职务列表
        /// </summary>
        /// <returns></returns>
        public static List<M7_Duty> GetDutyList()
        {
            return WcfClient.INFS.Invoke<List<M7_Duty>>(
                service => service.GetDutyList());
        }

        /// <summary>
        /// 获取职位等级列表
        /// </summary>
        /// <returns></returns>
        public static List<M7_Competence> GetCompetenceList()
        {
            return WcfClient.INFS.Invoke<List<M7_Competence>>(
                service => service.GetCompetenceList());
        }

        /// <summary>
        /// 获取性别列表
        /// </summary>
        /// <returns></returns>
        public static List<M7_Gender> GetGenderList()
        {
            return WcfClient.INFS.Invoke<List<M7_Gender>>(
                service => service.GetGenderList());
        }

        /// <summary>
        /// 获取证件类型
        /// </summary>
        /// <returns></returns>
        public static List<M7_IdentityType> GetIdentityTypeList()
        {
            return WcfClient.INFS.Invoke<List<M7_IdentityType>>(
                service => service.GetIdentityTypeList());
        }

        public static List<M7_Vendor> GetVendorList()
        {
            return WcfClient.INFS.Invoke<List<M7_Vendor>>(
                service => service.GetVendorList());
        }

        public static int AddVendor(M7_Vendor vendor)
        {
            object vendorId = WcfClient.INFS.Invoke<object>(
                service => service.AddVendor(vendor));

            return Convert.ToInt32(vendorId);
        }

        public static int SetVendor(EntityDeltaBase delta)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.SetVendor(delta));
        }

        public static int DeleteVendor(long vendorId)
        {
            return WcfClient.INFS.Invoke<int>(
                service => service.DeleteVendor(vendorId));
        }

        public static List<M7_ApproachForRecipe> GetRecipeApproachList()
        {
            return WcfClient.INFS.Invoke<List<M7_ApproachForRecipe>>(
                service => service.GetRecipeApproachList());
        }

        public static List<M7_FrequencyForRecipe> GetRecipeFrequencyList()
        {
            return WcfClient.INFS.Invoke<List<M7_FrequencyForRecipe>>(
                service => service.GetRecipeFrequencyList());
        }
        #endregion

        #region Private functions
        #endregion
    }
}
